/*INIT*/
$(document).ready(function() {
	
	searchSubmit.init();
	login.init();
});

var searchSubmit = {
	init: function() {
		$('.searchArea .body [name=searchSubmit]').click(searchSubmit.submit);
	},
	clear: function() {
		$('.orderArea').empty();
	},
	add: function(d) {
		var res = $(new EJS({url: getRootPath() + '/assets/ejs/myOrdersByPhone.ejs'}).render(d));
		$('.orderArea').append(res);
		resetFooter_2();
	},
	submit: function() {
		var search = $(this).parents('.searchArea');
		var data = {
			phone: 	search.find('[name=phone]').val()
		};
		auiAjax.send('filter', {
			url : getRootPath() + '/customerajax/myOrders!queryMyTodayOrders.action',
			data: data,
			cache: false,
			type: 'POST',
			dataType: 'json',
			success: function(d) {
//				if(d.errorCode != "") return;
				searchSubmit.clear();
				searchSubmit.add(d);
				$('.status').mouseenter(function(){$(this).find('.detailStatus').show();}).mouseleave(function(){$(this).find('.detailStatus').hide();});
			},
			error : function () {
//				alert("Get data error!");
			}
		});
	}
};

var login = {
	init: function() {
		$('#form_login .submit').click(function(){$('#form_login').submit();});
	}
};